package org.tis.tools.senior.module.developer.entity.enums;


import org.tis.tools.model.enums.BaseEnum;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * description: 工程类型
 *
 * @author lijh
 * @date 2018/9/26
 **/
public enum ProjectType implements BaseEnum {

    SPECIAL("S", "无类型工程"),
    JAVA("C", "JAVA工程"),
    PLUGINS("P","plugins工程"),
    IBS("I", "IBS工程");


    private final String value;

    private final String name;

    ProjectType(final String value, final String name) {
        this.value = value;
        this.name = name;
    }


    @Override
    public Serializable deserialze() {
        return value;
    }

    @Override
    public Serializable getValue() {
        return value;
    }

    @Override
    public String toString() {
        return name;
    }

    public static List<Map<String, Object>> getProjectPatchType(){
        List<Map<String, Object>> projectTypeLists = new ArrayList<>();
        for (ProjectType projectType:ProjectType.values()){
            Map<String, Object> projectMap = new HashMap<>();
            projectMap.put("value",projectType.value);
            projectMap.put("name", projectType);
            projectMap.put("children", PatchType.getPatchType(projectType));
            projectTypeLists.add(projectMap);
        }
        return projectTypeLists;
    }

}
